<?php

namespace App\Service;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;

class WxArticleData
{

    static public function get($link)
    {
        try {
            $url = 'http://118.190.55.146:8182/v3/readnum?data=' . urlencode($link) . '&key=f7f1e1da293c315ecf1a82a4b681b75a';
            $read_data = json_decode(file_get_contents($url));
            //剩余次数存入redis
            $count = $read_data->count;
            $redis  = Redis::connection();
            $redis->set('count',$count);
            return $read_data;
        } catch (\Exception $exception) {
            Log::error('获取公众号初始化数据失败：'.$exception->getMessage());
        }

    }

}
